package softswitch.ws;

import java.text.SimpleDateFormat;
import java.util.Date;
import javax.ejb.Stateless;
import softswitch.model.CallDetail;


@Stateless
public class CallLogger {
	
	//@EJB
	//SoftswitchService softswitchService;
	

	public void calllog(CallDetail calldetail, String level,String module, String message ){
		//CallLog calllog = new CallLog();
		//calllog.setCalldate(calldetail.getCalldate());
		//calllog.setCircuit(calldetail.getCircuit());
		//calllog.setDestination(calldetail.getDestination());
		//calllog.setLevel(level);
		//calllog.setMessage(message);
		//calllog.setModule(module);
		//calllog.setProcessdate(new Date());
		//softswitchService.saveCallLog(calllog);
		System.out.println(getDate()+ " DEBUG" + "["+calldetail.getDestination()+"] " +level + ": "+message );
	}
	
	public void debug(String id, String module, String message ) {
		System.out.println(getDate()+ " DEBUG" + "["+id+"] " +module + ": "+message );
	}
	
	public void info(String id, String module, String message ) {
		System.out.println(getDate()+ " INFO" + "["+id+"] " +module + ": "+message );
	}
	
	public void warning(String id, String module, String message ) {
		System.out.println(getDate()+ " WARNING" + "["+id+"] " +module + ": "+message );
	}
	
	public void error(String id, String module, String message ) {
		System.out.println(getDate()+ " ERROR" + "["+id+"] " +module + ": "+message );
	}
	
	public String getDate() {
		SimpleDateFormat dt1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		return dt1.format(new Date());
	}
	
}
